//基类，建议页面js，import Page from '../common/page';
import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast';

export default function (options = {}) {
  return Page({

    onShareAppMessage() {
      // 获取当前页面地址赋值returnUrl传给主页（index）
      return {
        title: '创课随学 - Share'
      };
    },
    //公共方法
    //顶部帘式提示
    showTopNotify(event) {
      Notify({
        message: event.currentTarget.dataset.msg,
        type: event.currentTarget.dataset.type || 'primary',
        background: event.currentTarget.dataset.background,
        textcolor: event.currentTarget.dataset.color,
        duration: event.currentTarget.dataset.duration || 3000,
        safeAreaInsetTop: false,
      });
    },
    //
    showToast(event) {
      Toast({
        type: event.currentTarget.dataset.type || 'text',
        message: event.currentTarget.dataset.msg,
        mask: event.currentTarget.dataset.mask || false,
        //是否禁止背景点击
        forbidClick: event.currentTarget.dataset.forbidClick || false,
        loadingType: event.currentTarget.dataset.loadingType || 'circular',//spinner
        zIndex: event.currentTarget.dataset.zIndex || 1000,
        duration: event.currentTarget.dataset.duration || 2000
      });
    },


    ...options
  });
}
